<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>JS_函数</title>
	<script>
		function $(id){return document.getElementById(id);}

		//阻止标签的默认动作.
		window.onload = function (){
			/**动态绑定函数   元素对象.   指定的事件   执行的函数体 **/
			document.getElementById("a1").addEventListener("click",function (e){
				e.preventDefault();
			})

			/**
			 * 1.找对象.
			 * 2.找想要响应的事件.
			 * 3.执行业务逻辑.
			 *
			 * */
			$("div1").addEventListener("copy",function (){
				alert("只有登陆后才能复制.")
				//调用Window 剪切板接口.将最后一次复制的内容删除掉.
			})

		}


	</script>
</head>
<body>
	<a href="#" id="a1" >百度</a>


	<div id="div1">
		this is a div <br>
		this is a div <br>
		this is a div <br>
		this is a div <br>
		this is a div <br>
		this is a div <br>
	</div>
</body>
</html>